﻿using System;
using System.Xml;
using digiTwitter.ExtensionMethods;

namespace digiTwitter
{
    public class TwitterStatus
    {
        public int Id { get; set; }
        public DateTime CreatedAt { get; set; }
        public String Text { get; set; }
        public String Source { get; set; }
        public bool Truncated { get; set; }
        public int InReplyToStatusId { get; set; }
        public int InReplyToUserId { get; set; }
        public bool Favorited { get; set; }
        public bool InReplyToScreenName { get; set; }


        /// <summary>
        /// Default Constructor.
        /// </summary>
        public TwitterStatus(){}

        /// <summary>
        /// Overload constructor based on a XmlDocument.
        /// </summary>
        /// <param name="statusNode">status node</param>
        public TwitterStatus(XmlNode statusNode)
        {
            Id = statusNode.GetInt("id");
            CreatedAt = statusNode.GetDateTime("created_at");
            Text = statusNode.GetString("text");
            Source = statusNode.GetString("source");
            Truncated = statusNode.GetBool("truncated");
            InReplyToScreenName = statusNode.GetBool("in_reply_to_screen_name");
            InReplyToStatusId = statusNode.GetInt("in_reply_to_status_id");
            InReplyToUserId = statusNode.GetInt("in_reply_to_user_id");
            Favorited = statusNode.GetBool("favorited");
        }
    }
}
